package com.xyz.study.design_mode.j_strategy;

import com.xyz.study.design_mode.j_strategy.mode.Printer;
import com.xyz.study.design_mode.j_strategy.mode.PrinterEnum;

/**
 * 分开考虑：其二 ---- Strategy策略模式
 * 角色：Client
 * 整体整体的替换实现算法，以不同算法解决相同的问题
 * @author XYZ
 * @version 1.0.0
 * @since 2021-01-26 21:25
 */
public class StrategyMain {
    public static void main(String[] args) {
        Printer printerLinux = PrinterEnum.getPrinter("linux");
        if (printerLinux != null) {
            printerLinux.printAddress(printerLinux.findAddress());
        }
        Printer printerWindows = PrinterEnum.getPrinter("windows");
        if (printerWindows != null) {
            printerWindows.printAddress(printerWindows.findAddress());
        }
    }
}
